<template>
	<view>
		<cu-custom bgColor="bg-gradual-pink" :isBack="true" :bgColorStyle="theme">
			<block slot="content">{{$t("详细")}}</block>
		</cu-custom>
		<view class="padding text-left">
			<view class="padding-lr bg-white">
				<view class="solid-bottom padding">
					<text class=""><text class="text-red">标题</text> : {{mainData.msgTitle}}</text>
				</view>
			</view>
			<view class="padding-lr bg-white">
				<view class="solid-bottom padding">
					<text class=""><text class="text-red">内容</text> : {{mainData.msgContent}}</text>
				</view>
			</view>
			<view class="padding-lr bg-white">
				<view class="solid-bottom padding">
					<text class=""><text class="text-red">发送者</text> : {{mainData.sendUserName}}</text>
				</view>
			</view>
			<view class="padding-lr bg-white">
				<view class="solid-bottom padding">
					<text class=""><text class="text-red">发送时间</text> : {{mainData.sendDate}}</text>
				</view>
			</view>
			<view class="padding-lr bg-white">
				<view class="solid-bottom padding">
					<text class=""><text class="text-red">读取时间</text> : {{mainData.updateDate}}</text>
				</view>
			</view>
			<view class="padding-lr bg-white">
				<view class="solid-bottom padding">
					<text class=""><text class="text-red">等级</text> : {{mainData.contentLevel}}</text>
				</view>
			</view>
			<view class="padding-lr bg-white">
				<view class="solid-bottom padding">
					<text class=""><text class="text-red">类型</text> : {{mainData.contentType}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState,mapActions} from 'vuex'
	export default {
		computed:{
			...mapState(["theme"])
		},
		data(){
			return {
				mainData:{}
			}
		},
		onLoad(e) {
			if(e.id){
				this.$request({
					url: "a/msg/msgInner/listData",
					data:{
						id: e.id
					},
					success:async(res)=>{
						let result = res.data.list
						this.mainData = result[0]
						this.mainData.msgContent = this.mainData.msgContent.replace('<!--HTML-->','')
						// 等级
						let res1 = await this.getDict({"dictType": "msg_inner_content_level"});
						res1.forEach((v,k)=>{
							if(v.value == this.mainData.contentLevel){
								this.mainData.contentLevel = v.name
							}
						})
						// 类型
						res1 = await this.getDict({"dictType": "msg_inner_content_type"});
						res1.forEach((v,k)=>{
							console.log(v.value == this.mainData.contentType)
							if(v.value == this.mainData.contentType){
								this.mainData.contentType = v.name
							}
						})
					}
				})
			}
		},
		methods:{
			...mapActions(["getDict"])
		}
	}
</script>

<style>
</style>
